// pages/collect/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    collect:[],
    tabs: [
      {
        id: 0,
        value: "我的收藏",
        isActivated: true
      },
      {
        id: 1,
        value: "品牌收藏",
        isActivated: false
      },
      {
        id: 2,
        value: "店铺收藏",
        isActivated: false
      },
      {
        id: 3,
        value: "浏览足迹",
        isActivated: false
      }
    ],
  },
  handleTabsChange(e) {
    // 获取被点击的标题索引
    const index = e.detail.index;
    // 修改原数组
    let {tabs} = this.data;
    tabs.forEach((v,i) => i===index ? v.isActivated = true : v.isActivated = false);
    this.setData({
      tabs
    })
  },
  onShow() {
    const collect = wx.getStorageSync("collect") || [];
    this.setData({
      collect
    });
  }
})